package com.gm.service.user;

import com.gm.dao.cardOper.ICardOperDao;
import com.gm.model.po.CardOperPlan;
import com.gm.tools.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gm.controller.dto.CardOperDTO;

import java.util.List;

/**
 * Created by taojie on 17-8-13.
 */
@Service
public class CardOperService {

    @Autowired
    private ICardOperDao cardOperDao;

    public int insert(CardOperPlan record){
        cardOperDao.insert(record);
        return record.getId();
    };

    public CardOperPlan getCardOperById(Integer id){
        return cardOperDao.selectByPrimaryKey(id);
    }

    public List<CardOperPlan> getCardOperListByBlid(Integer blid){
        return cardOperDao.getCardOperListByBlid(blid);
    }

    public List<CardOperDTO> getCardOperListByOperTime(long unix){
        return cardOperDao.getCardOperListByOperTime(unix);
    }

    public int update(CardOperPlan record){
        record.setUpdateTime(DateUtils.getCurrentUnixTime());
        cardOperDao.updateByPrimaryKey(record);
        return record.getId();
    }


}
